/* $Id: c._GetBytes 3.1 93/03/09 23:24:17 brian Exp $ */

#include "FS.h"

_kernel_oserror *fsentry_getbytes( FSEntry_GetBytes_Parameter *parm )
{
  FileEntry *fe=(FileEntry *)parm->getbytes_definition.handle;
  FileDesc d = FileEntry_Desc( fe );
  _kernel_oserror *e;
  int x;
  int pos,len;
#ifdef DEBUG
  printf("getbytes\n");
#endif
  if (d.buffered)
    return FileEntry_GetBytes(fe, parm->getbytes_definition.destination_start,
                parm->getbytes_definition.file_offset_to_get_data_from, 
                parm->getbytes_definition.bytes_to_read,&pos,&len);
  e = FileEntry_GetByte( fe, &x );
  parm->getbytes_result.byte_got = x;
  parm->getbytes_result.got_the_byte = e==NULL && x!=EOF;
  return e;
}
